<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="cn.school.mybatis.utils.MyBatisUtil" %>
<%@ page import="cn.school.mybatis.dao.GradeDao" %>
<%@ page import="cn.school.mybatis.pojo.Grade" %>
<%@ page import="java.util.List" %>
<%@ page import="cn.school.mybatis.dao.StudentDao" %>
<%@ page import="cn.school.mybatis.pojo.Student" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="cn.school.mybatis.service.StudentService" %><%--
  Created by IntelliJ IDEA.
  User: zhaoyang
  Date: 2020/8/3
  Time: 5:40 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">


    <title>学校管理系统</title>

    <link rel="icon"
          href="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1596120245889&di=5093bcb814a73039583d935c56ee7213&imgtype=0&src=http%3A%2F%2Fen.pimg.jp%2F041%2F867%2F367%2F1%2F41867367.jpg"/>

    <meta name="description" content="AdminLTE2定制版">
    <meta name="keywords" content="AdminLTE2定制版">


    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">

    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->


    <link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../plugins/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="../plugins/iCheck/square/blue.css">
    <link rel="stylesheet" href="../plugins/morris/morris.css">
    <link rel="stylesheet" href="../plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <link rel="stylesheet" href="../plugins/datepicker/datepicker3.css">
    <link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker.css">
    <link rel="stylesheet" href="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <link rel="stylesheet" href="../plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="../plugins/treeTable/jquery.treetable.css">
    <link rel="stylesheet" href="../plugins/treeTable/jquery.treetable.theme.default.css">
    <link rel="stylesheet" href="../plugins/select2/select2.css">
    <link rel="stylesheet" href="../plugins/colorpicker/bootstrap-colorpicker.min.css">
    <link rel="stylesheet" href="../plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
    <link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="../plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="../css/style.css">
    <link rel="stylesheet" href="../plugins/ionslider/ion.rangeSlider.css">
    <link rel="stylesheet" href="../plugins/ionslider/ion.rangeSlider.skinNice.css">
    <link rel="stylesheet" href="../plugins/bootstrap-slider/slider.css">
    <link rel="stylesheet" href="../plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">
</head>

<body class="hold-transition skin-purple sidebar-mini">

<div class="wrapper">

    <!-- 页面头部 -->
    <%@include file="../pageHead.jsp"%>
    <!-- 页面头部 /-->

    <!-- 导航侧栏 -->
    <%@include file="../pageLeft.jsp"%>
    <!-- 导航侧栏 /-->

    <!-- 内容区域 -->
    <!-- @@master = admin-layout.html-->
    <!-- @@block = content -->

    <div class="content-wrapper">

        <!-- 内容头部 -->
        <section class="content-header">
            <h1>
                学生信息管理
                <small>修改学生信息</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">学生信息管理</a></li>
                <li class="active">修改学生信息</li>
            </ol>
        </section>
        <!-- 内容头部 /-->

        <!-- 正文区域 -->
        <section class="content">

            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">欢迎登陆学校信息后台管理系统</h3>
                </div>

                <div class="box-body">

                    您可以在这里输入并修改学生信息<br> 如果需要帮助的话请点击侧边栏下方的帮助文档

                </div>
                <!--输入栏-->
                <!-- general form elements -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">修改学生信息</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form role="form" action="doUpdateStudent.jsp" method="post">
                        <div class="box-body">
                            <%
                                int num = new Integer(request.getParameter("stuno"));
                                Student result2 = StudentService.STUDENT_SERVICE.get(num);
                                if (result2 == null) {
//                                    out.print("<script>alert('未找到相关信息！');history.back();</script>");
                                    return;
                                }

                            %>

                            <!--基础控件-->
                            <div class="tab-pane" id="tab-common">
                                <div class="row data-type">
                                    <div class="col-md-2 title">学生姓名：</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-user-plus"></i></span>
                                            <input type="text" class="form-control" readonly
                                                   name="stuName" value="<%=result2.getSname()%>">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">学生性别</div>
                                    <div class="col-md-4 data">
                                        <div class="form-group form-inline" style="margin-left: 12px" readonly>
                                            <div class="radio"><label><input type="radio" name="stuSex" value="男"> 男</label></div>
                                            <div class="radio"><label><input type="radio" name="stuSex" value="女"> 女</label></div>
                                            <div class="radio"><label><input type="radio" name="stuSex" value="妖"> 妖</label></div>
                                            <div class="radio"><label><input type="radio" name="stuSex" value="人妖"> 人妖</label></div>
                                        </div>
                                    </div>


<%--                                    <div class="col-md-2 title">新的学生性别</div>--%>
<%--                                    <div class="col-md-4 data">--%>
<%--                                        <div class="input-group">--%>
<%--                                            <span class="input-group-addon"><i class="fa fa-venus-mars"></i></span>--%>
<%--                                            <select class="form-control select2" style="width: 100%;" name="stuSex">--%>
<%--                                                <%--%>
<%--                                                    String []sexs={"男","女","妖","人妖"};--%>
<%--                                                    for (String sex:sexs){--%>
<%--                                                        if (result2.getSex().equals(sex)){--%>
<%--                                                %>--%>
<%--                                                <option selected="selected" value="<%=sex%>"><%=sex%></option>--%>
<%--                                                <%--%>
<%--                                                        }else{--%>
<%--                                                %>--%>
<%--                                                <option value="<%=sex%>"><%=sex%></option>--%>
<%--                                                <%--%>
<%--                                                        }--%>
<%--                                                }--%>
<%--                                                %>--%>

<%--                                            </select>--%>
<%--                                        </div>--%>
<%--                                    </div>--%>

                                    <div class="col-md-2 title">学生电话：</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-address-book"></i></span>
                                            <input type="text" class="form-control" readonly
                                                   name="stuPhone" value="<%=result2.getTelephone()%>">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">学生QQ：</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-qq"></i></span>
                                            <input type="text" class="form-control" readonly name="stuQQ"
                                                   value="<%=result2.getQq()%>">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">学生微信：</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-weixin"></i></span>
                                            <input type="text" class="form-control" readonly
                                                   name="stuWechat" value="<%=result2.getWechat()%>">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">学生年级</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-sitemap"></i></span>
                                            <select class="form-control select2" style="width: 100%;" name="stuGrade" readonly>
                                                <%
                                                    SqlSession sess = MyBatisUtil.getSqlSession();
                                                    GradeDao gradeDao = sess.getMapper(GradeDao.class);
                                                    List<Grade> lists = gradeDao.searchAll();
                                                    MyBatisUtil.close(sess);
                                                    int i = result2.getGradeid();
                                                    for (Grade g : lists) {
                                                        if (result2.getGradeid()==g.getId()) {
                                                %>
                                                <option readonly="" value="<%=g.getId()%>" selected><%=g.getId()%>-<%=g.getGname()%></option>
                                                <%
                                                         }
                                                    }
                                                %>
                                            </select>
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">入学日期:</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group date">
                                            <div class="input-group-addon">
                                                <i class="fa fa-calendar-check-o"></i>
                                            </div>
                                            <input type="text" class="form-control pull-right datepicker"
                                                   name="enterTime" value="<%=result2.getEnterdate()%>" readonly>
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">学生生日:</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group date">
                                            <div class="input-group-addon">
                                                <i class="fa fa-birthday-cake"></i>
                                            </div>
                                            <input type="text" class="form-control pull-right datepicker"
                                                   name="stuBirth" value="<%=result2.getBirthday()%>" readonly>
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">学生来自城市：</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-home"></i></span>
                                            <input type="text" class="form-control" placeholder="请输入学生来自城市"
                                                   name="fromCity" value="<%=result2.getFromcity()%>" readonly>
                                        </div>
                                    </div>

                                    <div class="col-md-2 title">待修改的学生学号：</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-user"></i></span>
                                            <input type="text" class="form-control" readonly name="stuid"
                                                   value="<%=result2.getStuno()%>">
                                        </div>
                                    </div>

                                    <div class="col-md-2 title rowHeight2x">学生地址：</div>
                                    <div class="col-md-10 data rowHeight2x">
                                        <textarea class="form-control" rows="3" placeholder="请输入新的学生地址..."
                                                  name="stuAddr" readonly><%=result2.getAddress()%></textarea>
                                    </div>

                                    <div class="col-md-2 title">学生密码：</div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <span class="input-group-addon"><i class="fa fa-home"></i></span>
                                            <input type="text" class="form-control" placeholder="学生密码"
                                                   name="pass" value="<%=result2.getPass()%>" readonly>
                                        </div>
                                    </div>
                                    <%--空白占位div--%>
                                    <div class="col-md-2 title"></div>
                                    <div class="col-md-4 data">
                                        <div class="input-group">
                                            <%--<span class="input-group-addon"><i class="fa fa-address-book"></i></span>--%>
                                            <%--<input type="text" class="form-control" placeholder="学生来自城市">--%>
                                        </div>
                                    </div>
                                    <%--/空白占位div--%>

                                    <%--照片div--%>
                                    <div class="col-md-2 title" style="height: available">照片预览</div>
                                    <div class="col-md-10 data" style="height: auto">
                                        <div id="localImag" style="margin-left: 20px"><img id="preview" style="width: 20%;height: 20%;" src="<%=request.getContextPath()%>/images/<%=result2.getIdcardpic()%>"/>
                                        </div>

                                    </div>
                                    <%--/照片div--%>


                                    <div class="col-md-2 title"></div>
                                    <div class="col-md-10 data text-center">
                                        <button type="button" class="btn bg-default" onclick="history.back(-1);">返回上一级
                                        </button>
                                    </div>

                                </div>
                            </div>
                        </div>
                        <!--基础控件/-->
                    </form>
                </div>
                <!-- /.box -->

            </div>

        </section>
        <!-- 正文区域 /-->

    </div>
    <!-- @@close -->
    <!-- 内容区域 /-->

    <!-- 底部导航 -->
    <%@include file="../pageBottom.jsp"%>
    <!-- 底部导航 /-->

</div>


<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/jQueryUI/jquery-ui.min.js"></script>
<script>
    $.widget.bridge('uibutton', $.ui.button);
</script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="../plugins/raphael/raphael-min.js"></script>
<script src="../plugins/morris/morris.min.js"></script>
<script src="../plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="../plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="../plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="../plugins/knob/jquery.knob.js"></script>
<script src="../plugins/daterangepicker/moment.min.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.js"></script>
<script src="../plugins/daterangepicker/daterangepicker.zh-CN.js"></script>
<script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="../plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<script src="../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
<script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="../plugins/fastclick/fastclick.js"></script>
<script src="../plugins/iCheck/icheck.min.js"></script>
<script src="../plugins/adminLTE/js/app.min.js"></script>
<script src="../plugins/treeTable/jquery.treetable.js"></script>
<script src="../plugins/select2/select2.full.min.js"></script>
<script src="../plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script src="../plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.zh-CN.js"></script>
<script src="../plugins/bootstrap-markdown/js/bootstrap-markdown.js"></script>
<script src="../plugins/bootstrap-markdown/locale/bootstrap-markdown.zh.js"></script>
<script src="../plugins/bootstrap-markdown/js/markdown.js"></script>
<script src="../plugins/bootstrap-markdown/js/to-markdown.js"></script>
<script src="../plugins/ckeditor/ckeditor.js"></script>
<script src="../plugins/input-mask/jquery.inputmask.js"></script>
<script src="../plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="../plugins/input-mask/jquery.inputmask.extensions.js"></script>
<script src="../plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="../plugins/chartjs/Chart.min.js"></script>
<script src="../plugins/flot/jquery.flot.min.js"></script>
<script src="../plugins/flot/jquery.flot.resize.min.js"></script>
<script src="../plugins/flot/jquery.flot.pie.min.js"></script>
<script src="../plugins/flot/jquery.flot.categories.min.js"></script>
<script src="../plugins/ionslider/ion.rangeSlider.min.js"></script>
<script src="../plugins/bootstrap-slider/bootstrap-slider.js"></script>
<script src="../plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
<script src="../plugins/bootstrap-datetimepicker/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<script>

    $(function(){
        $(":radio[value=<%=result2.getSex()%>]").prop("checked",true);
        //照片
        // $("#preview").style({"display":"block","width":"150px","height":"80px"});

    });

    $(document).ready(function () {
        // 选择框
        $(".select2").select2();

        // WYSIHTML5编辑器
        $(".textarea").wysihtml5({
            locale: 'zh-CN'
        });
    });


    // 设置激活菜单
    function setSidebarActive(tagUri) {
        var liObj = $("#" + tagUri);
        if (liObj.length > 0) {
            liObj.parent().parent().addClass("active");
            liObj.addClass("active");
        }
    }

    //Date picker
    $('.datepicker').datepicker({
        autoclose: true,
        format: 'yyyy-mm-dd'
    });

    // // datetime picker
    // $('#dateTimePicker').datetimepicker({
    //     format: 'MM/DD/YYYY hh:mm A'
    // });

    $(document).ready(function () {
        setSidebarActive("stuAdd");
    });


</script>
</body>

</html>
